import { makeAutoObservable } from 'mobx'
import { GetUserInfo } from '../requests'
import auth from './auth'

export default new (class User {
    login: string = ''
    id: string = ''
    constructor() {
        makeAutoObservable(this)
    }
    SetUserInfo() {
        GetUserInfo().then((data) => {
            if (data.statusCode == '401') {
                auth.LogOut()
            } else {
                this.login = data.login
                this.id = data.id
            }
        })
    }
})()
